;/*=============================================================================
;#    The element-comm is a tentative program used to test our ideas.           
;#                       Copyright (C)  bgao                                    
;#
;#     This program is free software; you can redistribute it and/or            
;#      modify it under the terms of the GNU General Public License             
;#     as published by the Free Software Foundation; either version 2           
;#         of the License, or (at your option) any later version.               
;#
;#     This program is distributed in the hope that it will be useful,          
;#    but WITHOUT ANY WARRANTY; without even the implied warranty of           
;#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            
;#             GNU General Public License for more details.                    
;#
;#    You should have received a copy of the GNU General Public License        
;#     along with this program; if not, write to the Free Software             
;#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,             
;#                       MA  02110-1301, USA.                                  
;#==============================================================================
;# $Id$ 
;#
;# $Author$ 
;#
;# $Revision$ 
;#
;# $Date$ 
;#
;# Description: 
;#
;=============================================================================*/
.global do_init_stack

do_init_stack:
	ldi	R20, 0xCD
	IN	R26, 0x3D	;SPL
	IN	R27, 0x3E	;SPH
	mov	r18, r27
	mov	r19, r26
	subi	r18, 0x04	;0x0400=1k
	subi	r19, 0x00
	rjmp	do_init_stack_start
	
do_init_stack_loop:
	st	-X, r20
	
do_init_stack_start:
	cp	r26, r19
	cpc	r27, r18
	brne	do_init_stack_loop
	ret
	
	
	
